<!DOCTYPE html>
<html lang="en">

<!--php config-->
<?php include_once('config.php');?>
<!--php config end -->

<!--head-->
<?php require_once('./common_php/head.php');  ?>
<!--head end-->

<!-- js -->
<?php require_once('./common_php/js.php');  ?>
<!-- js end-->

<script>
mail_spool="<?php echo $mail_spool ?>";
</script>
<body>

	<!-- topbar-->
	<?php require_once('./common_php/top.php');  ?>
	<!-- topbar end-->

		<div class="container-fluid">
		<div class="row-fluid">

			<!-- menu_left -->
			<?php require_once('./common_php/menu_left.php');  ?>	
			<!-- menu_left end -->

			<!-- no_script -->
			<?php require_once('./common_php/noscript.php');  ?>	
			<!-- no_script end -->			
			
			<div id="content" class="span9">

			<!-- content starts --><!-- content starts --><!-- content starts --><!-- content starts --><!-- content starts -->
			<!-- content starts --><!-- content starts --><!-- content starts --><!-- content starts --><!-- content starts -->
			<!-- content starts --><!-- content starts --><!-- content starts --><!-- content starts --><!-- content starts -->
			
			<div class="row-fluid sortable">		
				<div class="box span10">
					<div class="box-header well" data-original-title>
						<h2><i class="icon-user"></i> <?php echo $domain_name;?></h2>
						<div class="box-icon">
							<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
							<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
						</div>
					</div>
					<div class="box-content">
						<table class="table table-striped table-bordered bootstrap-datatable datatable">
						  <thead>
							  <tr>
								  <th>POPアカウント</th>
								  <th>カタログ</th>
								  <th>割り当て容量</th>
								  <th>使用容量</th>
								  <th><a class="btn btn-info btn-plus" href="#" data-toggle="modal" data-target="#myModal">
                                                                                POPアカウントを作成	
                                                                        </a></th>
							  </tr>
						  </thead>   
						  <tbody>
							<?php 
							error_reporting(0);
							$file_handle = fopen("/etc/passwd", "r");
							while (!feof($file_handle)) {
								$line = fgets($file_handle);
							#Secho $line;
								$info = explode(':',$line); 
								if((int)$info[2] > 499){
									echo "<tr><td>".$info[0]."</td><td class=\"center\">".$info[5]."</td><td class=\"center\">";
									$cmd_tot="sudo repquota -auv| grep ".$info[0];
									$str_tot=exec($cmd_tot);
									$str_tot=preg_replace('/\s(?=\s)/', '', $str_tot);
									$arr_tot=explode(" ",$str_tot);
									echo (float)$arr_tot[4]/1024;
									echo "MB</td><td class=\"center\">";
									$cmd_shell = "du -sh ".$info[5];
									$str = exec($cmd_shell);
									$arr_str=explode($info[5],$str);
									echo $arr_str[0];
									echo "</td>";
									echo "<td class=\"center\">
									<a class=\"btn btn-info btn-edit\" href=\"#\"  name=\"".$info[0]."\" id=\"btn-edit\" onclick=\"getBtnEditV(event);\">
										修正                                         
									</a>
									<a class=\"btn btn-danger btn-dele\" href=\"#\" name=\"".$info[0]."\" onclick=\"getBtnDeleV(event)\">
										削除	
									</a>
								</td>";
									echo "</tr>";
								}							
							}
							?>
						</tbody>
					  </table>            
					</div>
				</div><!--/span-->
			
			</div><!--/row-->

		
		  
       
			<!-- content ends --><!-- content starts --><!-- content starts --><!-- content starts --><!-- content starts -->
			<!-- content ends --><!-- content starts --><!-- content starts --><!-- content starts --><!-- content starts -->
			<!-- content ends --><!-- content starts --><!-- content starts --><!-- content starts --><!-- content starts -->

			</div><!--/#content.span10-->
				</div><!--/fluid-row-->
				
		<hr>


			<!-- hide -->
			<div class="modal hide fade" id="edit_hide">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>ユーザーを修正</h3>
				</div>
				<div class="modal-body">
					<table class="table table-bordered table-striped">
						<tr>
							<td>POPアカウント</td>
							<td><input class="input disabled hide_edit_name"  id="disabledInput" type="text" value=""  disabled=""> @ <?php echo $domain_name;?></td>
                                                </tr>
						<tr>
                                                        <td>割り当て容量</td>
                                                        <td>
								<div class="input-append">
									 <input id="appendedInput hide_edit_content" size="16" type="text" class="hide_edit_content" value=""><span class="add-on">MB</span><p class="help-block">スペースは変更されません</p>
								</div>
							</td>


                                                </tr>
						<tr>
							<td>パスワード</td>
                                                        <td><input class="input-xlarge disabled hide_edit_passwd" id="hide_edit_passwd" type="text" value=""><p class="help-block">スペースは変更されません</p></td>
                                                </tr>
					</table>
				</div>
				<div class="modal-footer">
					<a href="#" class="btn" data-dismiss="modal">Close</a>
					<a href="#" class="btn btn-edit-submit">Save changes</a>
				</div>
			</div>
			<!-- hide end-->
                        <!-- hide -->
                        <div class="modal hide fade" id="plus_hide">
                                <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">×</button>
                                        <h3>POPアカウントを追加</h3>
                                </div>
                                <div class="modal-body">
                                        <table class="table table-bordered table-striped">
                                                <tr>
                                                        <td>POPアカウント</td>
                                                        <td><input id="input-xlarge" size="16" type="text" class="hide_plus_name"> @ <?php echo $domain_name;?>
							</td>
						
                                                </tr>
                                                <tr>
                                                        <td>割り当て容量</td>
                                                        <td>
                                                                <div class="input-append">
                                                                        <input id="appendedInput" class="hide_plus_total" size="16" type="text" value="100"><span class="add-on" id="hide_plus_tot">MB</span>
                                                                </div>
                                                        </td>


                                                </tr>
                                               <!-- <tr>
                                                        <td>ディレクトリ</td>
                                                        <td>
								<div class="input-append">
								<input id="appendedPrependedInput" class="hide_plus_dir_loc" size="16" type="text" value="/home/spool/"><span class="add-on" id="hide_plus_dir"></span>

								</div>
							</td>
                                                </tr>
						-->
						<tr>
							<td>パスワード
							</td>
							<td><input class="input-xlarge hide_plus_passwd" id="hide_plus_passwd" type="text" value="">
							</td>
						</tr>
                                        </table>
                                </div>
                                <div class="modal-footer">
                                        <a href="#" class="btn" data-dismiss="modal">Close</a>
                                        <a href="#" class="btn btn-plus-submit">Save changes</a>
                                </div>
                        </div>
                        <!-- hide end-->

		<!-- footer-->
		<?php require_once('./common_php/footer.php');  ?>
		<!-- footer end-->
		
	</div><!--/.fluid-container-->

	<!-- js -->
	<?php require_once('./common_php/js.php');  ?>
	<!-- js end-->
		
</body>
</html>
